unit ELE_ENTERPRISE;


interface
uses
  Classes,SysUtils,DB,Uni,UniEngine;

type
  TELEENTERPRISE=class(TUniEngine)
  private
    FSETYEAR  : Extended;
    FCHRID    : string;
    FCHRCODE  : string;
    FDISPCODE : string;                     
    FCHRNAME  : string;
    FLEVELNUM : Extended;
    FISLEAF   : Extended;
    FENABLED  : Extended;
    FCREATEDATE: string;
    FCREATEUSER: string;
    FLATESTOPDATE: string;
    FISDELETED: Extended;
    FLATESTOPUSER: string;
    FLASTVER  : string;
    FCHRCODE1 : string;
    FCHRCODE2 : string;
    FCHRCODE3 : string;
    FCHRCODE4 : string;
    FCHRCODE5 : string;
    FRGCODE   : string;
    FMAINCODE : string;
    FUNIONCODE: string;
    FENPROPERTY: string;
    FSORTPROPERTY: string;
    FENCHARGE : string;
    FFINANCECHARGE: string;
    FCLERK    : string;
    FDISTRICTNUMBER: string;
    FTELEPHONE: string;
    FEXTENSIONNUMBER: string;
    FADDRESS  : string;
    FMANAGELEVEL: string;
    FRELATION : string;
    FPARENTID : string;
    FCHRID1   : string;
    FCHRID2   : string;
    FCHRID3   : string;
    FCHRID4   : string;
    FCHRID5   : string;
    FCHRCODE6 : string;
    FCHRCODE7 : string;
    FCHRCODE8 : string;
    FCHRCODE9 : string;
    FCHRID6   : string;
    FCHRID7   : string;
    FCHRID8   : string;
    FCHRID9   : string;
    FISREFORM : Extended;
    FSTARTDATE: string;
    FENDDATE  : string;
    FSECRETDEGREE: Extended;
    FISBUDGET : Extended;
    FLULOADMOD: Extended;
    FENCFMOD  : Extended;
    FBSID     : string;
    FRESERVEAMT: Extended;
    FRESERVESTART: Extended;
    FRESERVEUSED: Extended;
    FMBID     : string;
    FENTYPE   : Extended;
    FDIVKIND  : string;
    FDIVFMKIND: string;
    FISLEGALINC: Extended;
    FISSYNC   : Extended;
    FISNEW    : Extended;
    FISVERTICAL: string;
    FBUSINESSTYPE: string;
    FFINANCETYPE: Extended;
    FMANAGETYPE: Extended;
  protected
    procedure SetParameters;override;
    function  GetStrInsert:string;override;
    function  GetStrUpdate:string;override;
    function  GetStrDelete:string;override;
  public
    function  GetStrsIndex:string;override;
  public
    function  GetNextIdex:Integer;overload;
    function  GetNextIdex(AUniConnection:TUniConnection):Integer;overload;
  public
    function  CheckExist(AUniConnection:TUniConnection):Boolean;override;
  public
    destructor  Destroy; override;
    constructor Create;  
  published
    property SETYEAR  : Extended read FSETYEAR   write FSETYEAR;
    property CHRID    : string read FCHRID     write FCHRID;
    property CHRCODE  : string read FCHRCODE   write FCHRCODE;
    property DISPCODE : string read FDISPCODE  write FDISPCODE;
    property CHRNAME  : string read FCHRNAME   write FCHRNAME;
    property LEVELNUM : Extended read FLEVELNUM  write FLEVELNUM;
    property ISLEAF   : Extended read FISLEAF    write FISLEAF;
    property ENABLED  : Extended read FENABLED   write FENABLED;
    property CREATEDATE: string read FCREATEDATE write FCREATEDATE;
    property CREATEUSER: string read FCREATEUSER write FCREATEUSER;
    property LATESTOPDATE: string read FLATESTOPDATE write FLATESTOPDATE;
    property ISDELETED: Extended read FISDELETED write FISDELETED;
    property LATESTOPUSER: string read FLATESTOPUSER write FLATESTOPUSER;
    property LASTVER  : string read FLASTVER   write FLASTVER;
    property CHRCODE1 : string read FCHRCODE1  write FCHRCODE1;
    property CHRCODE2 : string read FCHRCODE2  write FCHRCODE2;
    property CHRCODE3 : string read FCHRCODE3  write FCHRCODE3;
    property CHRCODE4 : string read FCHRCODE4  write FCHRCODE4;
    property CHRCODE5 : string read FCHRCODE5  write FCHRCODE5;
    property RGCODE   : string read FRGCODE    write FRGCODE;
    property MAINCODE : string read FMAINCODE  write FMAINCODE;
    property UNIONCODE: string read FUNIONCODE write FUNIONCODE;
    property ENPROPERTY: string read FENPROPERTY write FENPROPERTY;
    property SORTPROPERTY: string read FSORTPROPERTY write FSORTPROPERTY;
    property ENCHARGE : string read FENCHARGE  write FENCHARGE;
    property FINANCECHARGE: string read FFINANCECHARGE write FFINANCECHARGE;
    property CLERK    : string read FCLERK     write FCLERK;
    property DISTRICTNUMBER: string read FDISTRICTNUMBER write FDISTRICTNUMBER;
    property TELEPHONE: string read FTELEPHONE write FTELEPHONE;
    property EXTENSIONNUMBER: string read FEXTENSIONNUMBER write FEXTENSIONNUMBER;
    property ADDRESS  : string read FADDRESS   write FADDRESS;
    property MANAGELEVEL: string read FMANAGELEVEL write FMANAGELEVEL;
    property RELATION : string read FRELATION  write FRELATION;
    property PARENTID : string read FPARENTID  write FPARENTID;
    property CHRID1   : string read FCHRID1    write FCHRID1;
    property CHRID2   : string read FCHRID2    write FCHRID2;
    property CHRID3   : string read FCHRID3    write FCHRID3;
    property CHRID4   : string read FCHRID4    write FCHRID4;
    property CHRID5   : string read FCHRID5    write FCHRID5;
    property CHRCODE6 : string read FCHRCODE6  write FCHRCODE6;
    property CHRCODE7 : string read FCHRCODE7  write FCHRCODE7;
    property CHRCODE8 : string read FCHRCODE8  write FCHRCODE8;
    property CHRCODE9 : string read FCHRCODE9  write FCHRCODE9;
    property CHRID6   : string read FCHRID6    write FCHRID6;
    property CHRID7   : string read FCHRID7    write FCHRID7;
    property CHRID8   : string read FCHRID8    write FCHRID8;
    property CHRID9   : string read FCHRID9    write FCHRID9;
    property ISREFORM : Extended read FISREFORM  write FISREFORM;
    property STARTDATE: string read FSTARTDATE write FSTARTDATE;
    property ENDDATE  : string read FENDDATE   write FENDDATE;
    property SECRETDEGREE: Extended read FSECRETDEGREE write FSECRETDEGREE;
    property ISBUDGET : Extended read FISBUDGET  write FISBUDGET;
    property LULOADMOD: Extended read FLULOADMOD write FLULOADMOD;
    property ENCFMOD  : Extended read FENCFMOD   write FENCFMOD;
    property BSID     : string read FBSID      write FBSID;
    property RESERVEAMT: Extended read FRESERVEAMT write FRESERVEAMT;
    property RESERVESTART: Extended read FRESERVESTART write FRESERVESTART;
    property RESERVEUSED: Extended read FRESERVEUSED write FRESERVEUSED;
    property MBID     : string read FMBID      write FMBID;
    property ENTYPE   : Extended read FENTYPE    write FENTYPE;
    property DIVKIND  : string read FDIVKIND   write FDIVKIND;
    property DIVFMKIND: string read FDIVFMKIND write FDIVFMKIND;
    property ISLEGALINC: Extended read FISLEGALINC write FISLEGALINC;
    property ISSYNC   : Extended read FISSYNC    write FISSYNC;
    property ISNEW    : Extended read FISNEW     write FISNEW;
    property ISVERTICAL: string read FISVERTICAL write FISVERTICAL;
    property BUSINESSTYPE: string read FBUSINESSTYPE write FBUSINESSTYPE;
    property FINANCETYPE: Extended read FFINANCETYPE write FFINANCETYPE;
    property MANAGETYPE: Extended read FMANAGETYPE write FMANAGETYPE;    
  public
    class function  ReadDS(AUniQuery:TUniQuery):TUniEngine;override;
    class procedure ReadDS(AUniQuery:TUniQuery;var Result:TUniEngine);override;
    class function  CopyIt(AELEENTERPRISE:TELEENTERPRISE):TELEENTERPRISE;overload;        
    class procedure CopyIt(AELEENTERPRISE:TELEENTERPRISE;var Result:TELEENTERPRISE);overload;       
  end;

implementation

{ TELEENTERPRISE }
procedure TELEENTERPRISE.SetParameters;
begin
  inherited;
  with FUniSQL.Params do
  begin
    case FOptTyp of
      otAddx:
      begin
        ParamByName('SET_YEAR').Value := SETYEAR;
        ParamByName('CHR_ID').Value := CHRID;
        ParamByName('CHR_CODE').Value := CHRCODE;
        ParamByName('DISP_CODE').Value := DISPCODE;
        ParamByName('CHR_NAME').Value := CHRNAME;
        ParamByName('LEVEL_NUM').Value := LEVELNUM;
        ParamByName('IS_LEAF').Value := ISLEAF;
        ParamByName('ENABLED').Value := ENABLED;
        ParamByName('CREATE_DATE').Value := CREATEDATE;
        ParamByName('CREATE_USER').Value := CREATEUSER;
        ParamByName('LATEST_OP_DATE').Value := LATESTOPDATE;
        ParamByName('IS_DELETED').Value := ISDELETED;
        ParamByName('LATEST_OP_USER').Value := LATESTOPUSER;
        ParamByName('LAST_VER').Value := LASTVER;
        ParamByName('CHR_CODE1').Value := CHRCODE1;
        ParamByName('CHR_CODE2').Value := CHRCODE2;
        ParamByName('CHR_CODE3').Value := CHRCODE3;
        ParamByName('CHR_CODE4').Value := CHRCODE4;
        ParamByName('CHR_CODE5').Value := CHRCODE5;
        ParamByName('RG_CODE').Value := RGCODE;
        ParamByName('MAIN_CODE').Value := MAINCODE;
        ParamByName('UNION_CODE').Value := UNIONCODE;
        ParamByName('EN_PROPERTY').Value := ENPROPERTY;
        ParamByName('SORT_PROPERTY').Value := SORTPROPERTY;
        ParamByName('EN_CHARGE').Value := ENCHARGE;
        ParamByName('FINANCE_CHARGE').Value := FINANCECHARGE;
        ParamByName('CLERK').Value := CLERK;
        ParamByName('DISTRICT_NUMBER').Value := DISTRICTNUMBER;
        ParamByName('TELEPHONE').Value := TELEPHONE;
        ParamByName('EXTENSION_NUMBER').Value := EXTENSIONNUMBER;
        ParamByName('ADDRESS').Value := ADDRESS;
        ParamByName('MANAGE_LEVEL').Value := MANAGELEVEL;
        ParamByName('RELATION').Value := RELATION;
        ParamByName('PARENT_ID').Value := PARENTID;
        ParamByName('CHR_ID1').Value := CHRID1;
        ParamByName('CHR_ID2').Value := CHRID2;
        ParamByName('CHR_ID3').Value := CHRID3;
        ParamByName('CHR_ID4').Value := CHRID4;
        ParamByName('CHR_ID5').Value := CHRID5;
        ParamByName('CHR_CODE6').Value := CHRCODE6;
        ParamByName('CHR_CODE7').Value := CHRCODE7;
        ParamByName('CHR_CODE8').Value := CHRCODE8;
        ParamByName('CHR_CODE9').Value := CHRCODE9;
        ParamByName('CHR_ID6').Value := CHRID6;
        ParamByName('CHR_ID7').Value := CHRID7;
        ParamByName('CHR_ID8').Value := CHRID8;
        ParamByName('CHR_ID9').Value := CHRID9;
        ParamByName('IS_REFORM').Value := ISREFORM;
        ParamByName('START_DATE').Value := STARTDATE;
        ParamByName('END_DATE').Value := ENDDATE;
        ParamByName('SECRETDEGREE').Value := SECRETDEGREE;
        ParamByName('ISBUDGET').Value := ISBUDGET;
        ParamByName('LULOAD_MOD').Value := LULOADMOD;
        ParamByName('EN_CF_MOD').Value := ENCFMOD;
        ParamByName('BS_ID').Value := BSID;
        ParamByName('RESERVE_AMT').Value := RESERVEAMT;
        ParamByName('RESERVE_START').Value := RESERVESTART;
        ParamByName('RESERVE_USED').Value := RESERVEUSED;
        ParamByName('MB_ID').Value := MBID;
        ParamByName('EN_TYPE').Value := ENTYPE;
        ParamByName('DIV_KIND').Value := DIVKIND;
        ParamByName('DIV_FMKIND').Value := DIVFMKIND;
        ParamByName('IS_LEGALINC').Value := ISLEGALINC;
        ParamByName('IS_SYNC').Value := ISSYNC;
        ParamByName('IS_NEW').Value := ISNEW;
        ParamByName('ISVERTICAL').Value := ISVERTICAL;
        ParamByName('BUSINESSTYPE').Value := BUSINESSTYPE;
        ParamByName('FINANCE_TYPE').Value := FINANCETYPE;
        ParamByName('MANAGE_TYPE').Value := MANAGETYPE; 
      end;
      otEdit:
      begin
        ParamByName('SET_YEAR').Value := SETYEAR;
        ParamByName('CHR_ID').Value := CHRID;
        ParamByName('CHR_CODE').Value := CHRCODE;
        ParamByName('DISP_CODE').Value := DISPCODE;
        ParamByName('CHR_NAME').Value := CHRNAME;
        ParamByName('LEVEL_NUM').Value := LEVELNUM;
        ParamByName('IS_LEAF').Value := ISLEAF;
        ParamByName('ENABLED').Value := ENABLED;
        ParamByName('CREATE_DATE').Value := CREATEDATE;
        ParamByName('CREATE_USER').Value := CREATEUSER;
        ParamByName('LATEST_OP_DATE').Value := LATESTOPDATE;
        ParamByName('IS_DELETED').Value := ISDELETED;
        ParamByName('LATEST_OP_USER').Value := LATESTOPUSER;
        ParamByName('LAST_VER').Value := LASTVER;
        ParamByName('CHR_CODE1').Value := CHRCODE1;
        ParamByName('CHR_CODE2').Value := CHRCODE2;
        ParamByName('CHR_CODE3').Value := CHRCODE3;
        ParamByName('CHR_CODE4').Value := CHRCODE4;
        ParamByName('CHR_CODE5').Value := CHRCODE5;
        ParamByName('RG_CODE').Value := RGCODE;
        ParamByName('MAIN_CODE').Value := MAINCODE;
        ParamByName('UNION_CODE').Value := UNIONCODE;
        ParamByName('EN_PROPERTY').Value := ENPROPERTY;
        ParamByName('SORT_PROPERTY').Value := SORTPROPERTY;
        ParamByName('EN_CHARGE').Value := ENCHARGE;
        ParamByName('FINANCE_CHARGE').Value := FINANCECHARGE;
        ParamByName('CLERK').Value := CLERK;
        ParamByName('DISTRICT_NUMBER').Value := DISTRICTNUMBER;
        ParamByName('TELEPHONE').Value := TELEPHONE;
        ParamByName('EXTENSION_NUMBER').Value := EXTENSIONNUMBER;
        ParamByName('ADDRESS').Value := ADDRESS;
        ParamByName('MANAGE_LEVEL').Value := MANAGELEVEL;
        ParamByName('RELATION').Value := RELATION;
        ParamByName('PARENT_ID').Value := PARENTID;
        ParamByName('CHR_ID1').Value := CHRID1;
        ParamByName('CHR_ID2').Value := CHRID2;
        ParamByName('CHR_ID3').Value := CHRID3;
        ParamByName('CHR_ID4').Value := CHRID4;
        ParamByName('CHR_ID5').Value := CHRID5;
        ParamByName('CHR_CODE6').Value := CHRCODE6;
        ParamByName('CHR_CODE7').Value := CHRCODE7;
        ParamByName('CHR_CODE8').Value := CHRCODE8;
        ParamByName('CHR_CODE9').Value := CHRCODE9;
        ParamByName('CHR_ID6').Value := CHRID6;
        ParamByName('CHR_ID7').Value := CHRID7;
        ParamByName('CHR_ID8').Value := CHRID8;
        ParamByName('CHR_ID9').Value := CHRID9;
        ParamByName('IS_REFORM').Value := ISREFORM;
        ParamByName('START_DATE').Value := STARTDATE;
        ParamByName('END_DATE').Value := ENDDATE;
        ParamByName('SECRETDEGREE').Value := SECRETDEGREE;
        ParamByName('ISBUDGET').Value := ISBUDGET;
        ParamByName('LULOAD_MOD').Value := LULOADMOD;
        ParamByName('EN_CF_MOD').Value := ENCFMOD;
        ParamByName('BS_ID').Value := BSID;
        ParamByName('RESERVE_AMT').Value := RESERVEAMT;
        ParamByName('RESERVE_START').Value := RESERVESTART;
        ParamByName('RESERVE_USED').Value := RESERVEUSED;
        ParamByName('MB_ID').Value := MBID;
        ParamByName('EN_TYPE').Value := ENTYPE;
        ParamByName('DIV_KIND').Value := DIVKIND;
        ParamByName('DIV_FMKIND').Value := DIVFMKIND;
        ParamByName('IS_LEGALINC').Value := ISLEGALINC;
        ParamByName('IS_SYNC').Value := ISSYNC;
        ParamByName('IS_NEW').Value := ISNEW;
        ParamByName('ISVERTICAL').Value := ISVERTICAL;
        ParamByName('BUSINESSTYPE').Value := BUSINESSTYPE;
        ParamByName('FINANCE_TYPE').Value := FINANCETYPE;
        ParamByName('MANAGE_TYPE').Value := MANAGETYPE; 
      end;  
      otDelt:
      begin
        ParamByName('CHR_ID').Value := CHRID;
 
      end;  
    end;
  end;
end;

function TELEENTERPRISE.CheckExist(AUniConnection: TUniConnection): Boolean;
begin
  Result:=CheckExist('ELE_ENTERPRISE',['CHR_ID',CHRID],AUniConnection);
end;

function TELEENTERPRISE.GetNextIdex: Integer;
begin

end;

function TELEENTERPRISE.GetNextIdex(AUniConnection: TUniConnection): Integer;
begin

end;

function TELEENTERPRISE.GetStrDelete: string;
begin
  Result:='DELETE FROM ELE_ENTERPRISE WHERE   CHR_ID=:CHR_ID';
end;

function TELEENTERPRISE.GetStrInsert: string;
begin
  Result:='INSERT INTO ELE_ENTERPRISE'
         +'    ( SET_YEAR, CHR_ID, CHR_CODE, DISP_CODE, CHR_NAME, LEVEL_NUM'
         +'    , IS_LEAF, ENABLED, CREATE_DATE, CREATE_USER, LATEST_OP_DATE'
         +'    , IS_DELETED, LATEST_OP_USER, LAST_VER, CHR_CODE1, CHR_CODE2'
         +'    , CHR_CODE3, CHR_CODE4, CHR_CODE5, RG_CODE, MAIN_CODE'
         +'    , UNION_CODE, EN_PROPERTY, SORT_PROPERTY, EN_CHARGE'
         +'    , FINANCE_CHARGE, CLERK, DISTRICT_NUMBER, TELEPHONE'
         +'    , EXTENSION_NUMBER, ADDRESS, MANAGE_LEVEL, RELATION'
         +'    , PARENT_ID, CHR_ID1, CHR_ID2, CHR_ID3, CHR_ID4, CHR_ID5'
         +'    , CHR_CODE6, CHR_CODE7, CHR_CODE8, CHR_CODE9, CHR_ID6'
         +'    , CHR_ID7, CHR_ID8, CHR_ID9, IS_REFORM, START_DATE, END_DATE'
         +'    , SECRETDEGREE, ISBUDGET, LULOAD_MOD, EN_CF_MOD, BS_ID'
         +'    , RESERVE_AMT, RESERVE_START, RESERVE_USED, MB_ID, EN_TYPE'
         +'    , DIV_KIND, DIV_FMKIND, IS_LEGALINC, IS_SYNC, IS_NEW'
         +'    , ISVERTICAL, BUSINESSTYPE, FINANCE_TYPE, MANAGE_TYPE)'
         +'    VALUES'
         +'    (:SET_YEAR,:CHR_ID,:CHR_CODE,:DISP_CODE,:CHR_NAME,:LEVEL_NUM'
         +'    ,:IS_LEAF,:ENABLED,:CREATE_DATE,:CREATE_USER,:LATEST_OP_DATE'
         +'    ,:IS_DELETED,:LATEST_OP_USER,:LAST_VER,:CHR_CODE1,:CHR_CODE2'
         +'    ,:CHR_CODE3,:CHR_CODE4,:CHR_CODE5,:RG_CODE,:MAIN_CODE'
         +'    ,:UNION_CODE,:EN_PROPERTY,:SORT_PROPERTY,:EN_CHARGE'
         +'    ,:FINANCE_CHARGE,:CLERK,:DISTRICT_NUMBER,:TELEPHONE'
         +'    ,:EXTENSION_NUMBER,:ADDRESS,:MANAGE_LEVEL,:RELATION'
         +'    ,:PARENT_ID,:CHR_ID1,:CHR_ID2,:CHR_ID3,:CHR_ID4,:CHR_ID5'
         +'    ,:CHR_CODE6,:CHR_CODE7,:CHR_CODE8,:CHR_CODE9,:CHR_ID6'
         +'    ,:CHR_ID7,:CHR_ID8,:CHR_ID9,:IS_REFORM,:START_DATE,:END_DATE'
         +'    ,:SECRETDEGREE,:ISBUDGET,:LULOAD_MOD,:EN_CF_MOD,:BS_ID'
         +'    ,:RESERVE_AMT,:RESERVE_START,:RESERVE_USED,:MB_ID,:EN_TYPE'
         +'    ,:DIV_KIND,:DIV_FMKIND,:IS_LEGALINC,:IS_SYNC,:IS_NEW'
         +'    ,:ISVERTICAL,:BUSINESSTYPE,:FINANCE_TYPE,:MANAGE_TYPE)';
end;

function TELEENTERPRISE.GetStrsIndex: string;
begin
  Result:=Format('%S',[CHRID]);
end;

function TELEENTERPRISE.GetStrUpdate: string;
begin
  Result:='UPDATE  ELE_ENTERPRISE SET'
         +'    SET_YEAR=:SET_YEAR,'
         +'    CHR_CODE=:CHR_CODE,'
         +'    DISP_CODE=:DISP_CODE,'
         +'    CHR_NAME=:CHR_NAME,'
         +'    LEVEL_NUM=:LEVEL_NUM,'
         +'    IS_LEAF=:IS_LEAF,'
         +'    ENABLED=:ENABLED,'
         +'    CREATE_DATE=:CREATE_DATE,'
         +'    CREATE_USER=:CREATE_USER,'
         +'    LATEST_OP_DATE=:LATEST_OP_DATE,'
         +'    IS_DELETED=:IS_DELETED,'
         +'    LATEST_OP_USER=:LATEST_OP_USER,'
         +'    LAST_VER=:LAST_VER,'
         +'    CHR_CODE1=:CHR_CODE1,'
         +'    CHR_CODE2=:CHR_CODE2,'
         +'    CHR_CODE3=:CHR_CODE3,'
         +'    CHR_CODE4=:CHR_CODE4,'
         +'    CHR_CODE5=:CHR_CODE5,'
         +'    RG_CODE=:RG_CODE,'
         +'    MAIN_CODE=:MAIN_CODE,'
         +'    UNION_CODE=:UNION_CODE,'
         +'    EN_PROPERTY=:EN_PROPERTY,'
         +'    SORT_PROPERTY=:SORT_PROPERTY,'
         +'    EN_CHARGE=:EN_CHARGE,'
         +'    FINANCE_CHARGE=:FINANCE_CHARGE,'
         +'    CLERK=:CLERK,'
         +'    DISTRICT_NUMBER=:DISTRICT_NUMBER,'
         +'    TELEPHONE=:TELEPHONE,'
         +'    EXTENSION_NUMBER=:EXTENSION_NUMBER,'
         +'    ADDRESS=:ADDRESS,'
         +'    MANAGE_LEVEL=:MANAGE_LEVEL,'
         +'    RELATION=:RELATION,'
         +'    PARENT_ID=:PARENT_ID,'
         +'    CHR_ID1=:CHR_ID1,'
         +'    CHR_ID2=:CHR_ID2,'
         +'    CHR_ID3=:CHR_ID3,'
         +'    CHR_ID4=:CHR_ID4,'
         +'    CHR_ID5=:CHR_ID5,'
         +'    CHR_CODE6=:CHR_CODE6,'
         +'    CHR_CODE7=:CHR_CODE7,'
         +'    CHR_CODE8=:CHR_CODE8,'
         +'    CHR_CODE9=:CHR_CODE9,'
         +'    CHR_ID6=:CHR_ID6,'
         +'    CHR_ID7=:CHR_ID7,'
         +'    CHR_ID8=:CHR_ID8,'
         +'    CHR_ID9=:CHR_ID9,'
         +'    IS_REFORM=:IS_REFORM,'
         +'    START_DATE=:START_DATE,'
         +'    END_DATE=:END_DATE,'
         +'    SECRETDEGREE=:SECRETDEGREE,'
         +'    ISBUDGET=:ISBUDGET,'
         +'    LULOAD_MOD=:LULOAD_MOD,'
         +'    EN_CF_MOD=:EN_CF_MOD,'
         +'    BS_ID=:BS_ID,'
         +'    RESERVE_AMT=:RESERVE_AMT,'
         +'    RESERVE_START=:RESERVE_START,'
         +'    RESERVE_USED=:RESERVE_USED,'
         +'    MB_ID=:MB_ID,'
         +'    EN_TYPE=:EN_TYPE,'
         +'    DIV_KIND=:DIV_KIND,'
         +'    DIV_FMKIND=:DIV_FMKIND,'
         +'    IS_LEGALINC=:IS_LEGALINC,'
         +'    IS_SYNC=:IS_SYNC,'
         +'    IS_NEW=:IS_NEW,'
         +'    ISVERTICAL=:ISVERTICAL,'
         +'    BUSINESSTYPE=:BUSINESSTYPE,'
         +'    FINANCE_TYPE=:FINANCE_TYPE,'
         +'    MANAGE_TYPE=:MANAGE_TYPE'
         +'    WHERE CHR_ID=:CHR_ID';
end;

constructor TELEENTERPRISE.Create;
begin

end;

destructor TELEENTERPRISE.Destroy;
begin

  inherited;
end;

class function TELEENTERPRISE.ReadDS(AUniQuery: TUniQuery): TUniEngine;
var
  I:Integer;
  Field:TField;
  FieldName:string;
begin
  Result:=TELEENTERPRISE.Create;

  with TELEENTERPRISE(Result) do
  begin
    for I:=0 to AUniQuery.Fields.Count-1 do
    begin
      Field:=AUniQuery.Fields.Fields[I];
      //if field.fieldname is not all uppercase,please use uppercase().
      FieldName:=Field.FieldName;
      if FieldName='SET_YEAR' then
      begin
        SETYEAR  :=Field.AsFloat;
      end else
      if FieldName='CHR_ID' then
      begin
        CHRID    :=Field.AsString;
      end else
      if FieldName='CHR_CODE' then
      begin
        CHRCODE  :=Field.AsString;
      end else
      if FieldName='DISP_CODE' then
      begin
        DISPCODE :=Field.AsString;
      end else
      if FieldName='CHR_NAME' then
      begin
        CHRNAME  :=Field.AsString;
      end else
      if FieldName='LEVEL_NUM' then
      begin
        LEVELNUM :=Field.AsFloat;
      end else
      if FieldName='IS_LEAF' then
      begin
        ISLEAF   :=Field.AsFloat;
      end else
      if FieldName='ENABLED' then
      begin
        ENABLED  :=Field.AsFloat;
      end else
      if FieldName='CREATE_DATE' then
      begin
        CREATEDATE:=Field.AsString;
      end else
      if FieldName='CREATE_USER' then
      begin
        CREATEUSER:=Field.AsString;
      end else
      if FieldName='LATEST_OP_DATE' then
      begin
        LATESTOPDATE:=Field.AsString;
      end else
      if FieldName='IS_DELETED' then
      begin
        ISDELETED:=Field.AsFloat;
      end else
      if FieldName='LATEST_OP_USER' then
      begin
        LATESTOPUSER:=Field.AsString;
      end else
      if FieldName='LAST_VER' then
      begin
        LASTVER  :=Field.AsString;
      end else
      if FieldName='CHR_CODE1' then
      begin
        CHRCODE1 :=Field.AsString;
      end else
      if FieldName='CHR_CODE2' then
      begin
        CHRCODE2 :=Field.AsString;
      end else
      if FieldName='CHR_CODE3' then
      begin
        CHRCODE3 :=Field.AsString;
      end else
      if FieldName='CHR_CODE4' then
      begin
        CHRCODE4 :=Field.AsString;
      end else
      if FieldName='CHR_CODE5' then
      begin
        CHRCODE5 :=Field.AsString;
      end else
      if FieldName='RG_CODE' then
      begin
        RGCODE   :=Field.AsString;
      end else
      if FieldName='MAIN_CODE' then
      begin
        MAINCODE :=Field.AsString;
      end else
      if FieldName='UNION_CODE' then
      begin
        UNIONCODE:=Field.AsString;
      end else
      if FieldName='EN_PROPERTY' then
      begin
        ENPROPERTY:=Field.AsString;
      end else
      if FieldName='SORT_PROPERTY' then
      begin
        SORTPROPERTY:=Field.AsString;
      end else
      if FieldName='EN_CHARGE' then
      begin
        ENCHARGE :=Field.AsString;
      end else
      if FieldName='FINANCE_CHARGE' then
      begin
        FINANCECHARGE:=Field.AsString;
      end else
      if FieldName='CLERK' then
      begin
        CLERK    :=Field.AsString;
      end else
      if FieldName='DISTRICT_NUMBER' then
      begin
        DISTRICTNUMBER:=Field.AsString;
      end else
      if FieldName='TELEPHONE' then
      begin
        TELEPHONE:=Field.AsString;
      end else
      if FieldName='EXTENSION_NUMBER' then
      begin
        EXTENSIONNUMBER:=Field.AsString;
      end else
      if FieldName='ADDRESS' then
      begin
        ADDRESS  :=Field.AsString;
      end else
      if FieldName='MANAGE_LEVEL' then
      begin
        MANAGELEVEL:=Field.AsString;
      end else
      if FieldName='RELATION' then
      begin
        RELATION :=Field.AsString;
      end else
      if FieldName='PARENT_ID' then
      begin
        PARENTID :=Field.AsString;
      end else
      if FieldName='CHR_ID1' then
      begin
        CHRID1   :=Field.AsString;
      end else
      if FieldName='CHR_ID2' then
      begin
        CHRID2   :=Field.AsString;
      end else
      if FieldName='CHR_ID3' then
      begin
        CHRID3   :=Field.AsString;
      end else
      if FieldName='CHR_ID4' then
      begin
        CHRID4   :=Field.AsString;
      end else
      if FieldName='CHR_ID5' then
      begin
        CHRID5   :=Field.AsString;
      end else
      if FieldName='CHR_CODE6' then
      begin
        CHRCODE6 :=Field.AsString;
      end else
      if FieldName='CHR_CODE7' then
      begin
        CHRCODE7 :=Field.AsString;
      end else
      if FieldName='CHR_CODE8' then
      begin
        CHRCODE8 :=Field.AsString;
      end else
      if FieldName='CHR_CODE9' then
      begin
        CHRCODE9 :=Field.AsString;
      end else
      if FieldName='CHR_ID6' then
      begin
        CHRID6   :=Field.AsString;
      end else
      if FieldName='CHR_ID7' then
      begin
        CHRID7   :=Field.AsString;
      end else
      if FieldName='CHR_ID8' then
      begin
        CHRID8   :=Field.AsString;
      end else
      if FieldName='CHR_ID9' then
      begin
        CHRID9   :=Field.AsString;
      end else
      if FieldName='IS_REFORM' then
      begin
        ISREFORM :=Field.AsFloat;
      end else
      if FieldName='START_DATE' then
      begin
        STARTDATE:=Field.AsString;
      end else
      if FieldName='END_DATE' then
      begin
        ENDDATE  :=Field.AsString;
      end else
      if FieldName='SECRETDEGREE' then
      begin
        SECRETDEGREE:=Field.AsFloat;
      end else
      if FieldName='ISBUDGET' then
      begin
        ISBUDGET :=Field.AsFloat;
      end else
      if FieldName='LULOAD_MOD' then
      begin
        LULOADMOD:=Field.AsFloat;
      end else
      if FieldName='EN_CF_MOD' then
      begin
        ENCFMOD  :=Field.AsFloat;
      end else
      if FieldName='BS_ID' then
      begin
        BSID     :=Field.AsString;
      end else
      if FieldName='RESERVE_AMT' then
      begin
        RESERVEAMT:=Field.AsFloat;
      end else
      if FieldName='RESERVE_START' then
      begin
        RESERVESTART:=Field.AsFloat;
      end else
      if FieldName='RESERVE_USED' then
      begin
        RESERVEUSED:=Field.AsFloat;
      end else
      if FieldName='MB_ID' then
      begin
        MBID     :=Field.AsString;
      end else
      if FieldName='EN_TYPE' then
      begin
        ENTYPE   :=Field.AsFloat;
      end else
      if FieldName='DIV_KIND' then
      begin
        DIVKIND  :=Field.AsString;
      end else
      if FieldName='DIV_FMKIND' then
      begin
        DIVFMKIND:=Field.AsString;
      end else
      if FieldName='IS_LEGALINC' then
      begin
        ISLEGALINC:=Field.AsFloat;
      end else
      if FieldName='IS_SYNC' then
      begin
        ISSYNC   :=Field.AsFloat;
      end else
      if FieldName='IS_NEW' then
      begin
        ISNEW    :=Field.AsFloat;
      end else
      if FieldName='ISVERTICAL' then
      begin
        ISVERTICAL:=Field.AsString;
      end else
      if FieldName='BUSINESSTYPE' then
      begin
        BUSINESSTYPE:=Field.AsString;
      end else
      if FieldName='FINANCE_TYPE' then
      begin
        FINANCETYPE:=Field.AsFloat;
      end else
      if FieldName='MANAGE_TYPE' then
      begin
        MANAGETYPE:=Field.AsFloat;
      end;
    end
  end;  
end;

class procedure TELEENTERPRISE.ReadDS(AUniQuery: TUniQuery; var Result: TUniEngine);
var
  I:Integer;
  Field:TField;
  FieldName:string;
begin
  if Result=nil then Exit;

  with TELEENTERPRISE(Result) do
  begin
    for I:=0 to AUniQuery.Fields.Count-1 do
    begin
      Field:=AUniQuery.Fields.Fields[I];
      //if field.fieldname is not all uppercase,please use uppercase().
      FieldName:=Field.FieldName;
      if FieldName='SET_YEAR' then
      begin
        SETYEAR  :=Field.AsFloat;
      end else
      if FieldName='CHR_ID' then
      begin
        CHRID    :=Field.AsString;
      end else
      if FieldName='CHR_CODE' then
      begin
        CHRCODE  :=Field.AsString;
      end else
      if FieldName='DISP_CODE' then
      begin
        DISPCODE :=Field.AsString;
      end else
      if FieldName='CHR_NAME' then
      begin
        CHRNAME  :=Field.AsString;
      end else
      if FieldName='LEVEL_NUM' then
      begin
        LEVELNUM :=Field.AsFloat;
      end else
      if FieldName='IS_LEAF' then
      begin
        ISLEAF   :=Field.AsFloat;
      end else
      if FieldName='ENABLED' then
      begin
        ENABLED  :=Field.AsFloat;
      end else
      if FieldName='CREATE_DATE' then
      begin
        CREATEDATE:=Field.AsString;
      end else
      if FieldName='CREATE_USER' then
      begin
        CREATEUSER:=Field.AsString;
      end else
      if FieldName='LATEST_OP_DATE' then
      begin
        LATESTOPDATE:=Field.AsString;
      end else
      if FieldName='IS_DELETED' then
      begin
        ISDELETED:=Field.AsFloat;
      end else
      if FieldName='LATEST_OP_USER' then
      begin
        LATESTOPUSER:=Field.AsString;
      end else
      if FieldName='LAST_VER' then
      begin
        LASTVER  :=Field.AsString;
      end else
      if FieldName='CHR_CODE1' then
      begin
        CHRCODE1 :=Field.AsString;
      end else
      if FieldName='CHR_CODE2' then
      begin
        CHRCODE2 :=Field.AsString;
      end else
      if FieldName='CHR_CODE3' then
      begin
        CHRCODE3 :=Field.AsString;
      end else
      if FieldName='CHR_CODE4' then
      begin
        CHRCODE4 :=Field.AsString;
      end else
      if FieldName='CHR_CODE5' then
      begin
        CHRCODE5 :=Field.AsString;
      end else
      if FieldName='RG_CODE' then
      begin
        RGCODE   :=Field.AsString;
      end else
      if FieldName='MAIN_CODE' then
      begin
        MAINCODE :=Field.AsString;
      end else
      if FieldName='UNION_CODE' then
      begin
        UNIONCODE:=Field.AsString;
      end else
      if FieldName='EN_PROPERTY' then
      begin
        ENPROPERTY:=Field.AsString;
      end else
      if FieldName='SORT_PROPERTY' then
      begin
        SORTPROPERTY:=Field.AsString;
      end else
      if FieldName='EN_CHARGE' then
      begin
        ENCHARGE :=Field.AsString;
      end else
      if FieldName='FINANCE_CHARGE' then
      begin
        FINANCECHARGE:=Field.AsString;
      end else
      if FieldName='CLERK' then
      begin
        CLERK    :=Field.AsString;
      end else
      if FieldName='DISTRICT_NUMBER' then
      begin
        DISTRICTNUMBER:=Field.AsString;
      end else
      if FieldName='TELEPHONE' then
      begin
        TELEPHONE:=Field.AsString;
      end else
      if FieldName='EXTENSION_NUMBER' then
      begin
        EXTENSIONNUMBER:=Field.AsString;
      end else
      if FieldName='ADDRESS' then
      begin
        ADDRESS  :=Field.AsString;
      end else
      if FieldName='MANAGE_LEVEL' then
      begin
        MANAGELEVEL:=Field.AsString;
      end else
      if FieldName='RELATION' then
      begin
        RELATION :=Field.AsString;
      end else
      if FieldName='PARENT_ID' then
      begin
        PARENTID :=Field.AsString;
      end else
      if FieldName='CHR_ID1' then
      begin
        CHRID1   :=Field.AsString;
      end else
      if FieldName='CHR_ID2' then
      begin
        CHRID2   :=Field.AsString;
      end else
      if FieldName='CHR_ID3' then
      begin
        CHRID3   :=Field.AsString;
      end else
      if FieldName='CHR_ID4' then
      begin
        CHRID4   :=Field.AsString;
      end else
      if FieldName='CHR_ID5' then
      begin
        CHRID5   :=Field.AsString;
      end else
      if FieldName='CHR_CODE6' then
      begin
        CHRCODE6 :=Field.AsString;
      end else
      if FieldName='CHR_CODE7' then
      begin
        CHRCODE7 :=Field.AsString;
      end else
      if FieldName='CHR_CODE8' then
      begin
        CHRCODE8 :=Field.AsString;
      end else
      if FieldName='CHR_CODE9' then
      begin
        CHRCODE9 :=Field.AsString;
      end else
      if FieldName='CHR_ID6' then
      begin
        CHRID6   :=Field.AsString;
      end else
      if FieldName='CHR_ID7' then
      begin
        CHRID7   :=Field.AsString;
      end else
      if FieldName='CHR_ID8' then
      begin
        CHRID8   :=Field.AsString;
      end else
      if FieldName='CHR_ID9' then
      begin
        CHRID9   :=Field.AsString;
      end else
      if FieldName='IS_REFORM' then
      begin
        ISREFORM :=Field.AsFloat;
      end else
      if FieldName='START_DATE' then
      begin
        STARTDATE:=Field.AsString;
      end else
      if FieldName='END_DATE' then
      begin
        ENDDATE  :=Field.AsString;
      end else
      if FieldName='SECRETDEGREE' then
      begin
        SECRETDEGREE:=Field.AsFloat;
      end else
      if FieldName='ISBUDGET' then
      begin
        ISBUDGET :=Field.AsFloat;
      end else
      if FieldName='LULOAD_MOD' then
      begin
        LULOADMOD:=Field.AsFloat;
      end else
      if FieldName='EN_CF_MOD' then
      begin
        ENCFMOD  :=Field.AsFloat;
      end else
      if FieldName='BS_ID' then
      begin
        BSID     :=Field.AsString;
      end else
      if FieldName='RESERVE_AMT' then
      begin
        RESERVEAMT:=Field.AsFloat;
      end else
      if FieldName='RESERVE_START' then
      begin
        RESERVESTART:=Field.AsFloat;
      end else
      if FieldName='RESERVE_USED' then
      begin
        RESERVEUSED:=Field.AsFloat;
      end else
      if FieldName='MB_ID' then
      begin
        MBID     :=Field.AsString;
      end else
      if FieldName='EN_TYPE' then
      begin
        ENTYPE   :=Field.AsFloat;
      end else
      if FieldName='DIV_KIND' then
      begin
        DIVKIND  :=Field.AsString;
      end else
      if FieldName='DIV_FMKIND' then
      begin
        DIVFMKIND:=Field.AsString;
      end else
      if FieldName='IS_LEGALINC' then
      begin
        ISLEGALINC:=Field.AsFloat;
      end else
      if FieldName='IS_SYNC' then
      begin
        ISSYNC   :=Field.AsFloat;
      end else
      if FieldName='IS_NEW' then
      begin
        ISNEW    :=Field.AsFloat;
      end else
      if FieldName='ISVERTICAL' then
      begin
        ISVERTICAL:=Field.AsString;
      end else
      if FieldName='BUSINESSTYPE' then
      begin
        BUSINESSTYPE:=Field.AsString;
      end else
      if FieldName='FINANCE_TYPE' then
      begin
        FINANCETYPE:=Field.AsFloat;
      end else
      if FieldName='MANAGE_TYPE' then
      begin
        MANAGETYPE:=Field.AsFloat;
      end;
    end
  end;  
end;

class function  TELEENTERPRISE.CopyIt(AELEENTERPRISE: TELEENTERPRISE): TELEENTERPRISE;
begin
  Result:=TELEENTERPRISE.Create;
  TELEENTERPRISE.CopyIt(AELEENTERPRISE,Result)
end;

class procedure TELEENTERPRISE.CopyIt(AELEENTERPRISE:TELEENTERPRISE;var Result:TELEENTERPRISE);
begin
  if Result=nil then Exit;
  Result.SETYEAR  :=AELEENTERPRISE.SETYEAR;
  Result.CHRID    :=AELEENTERPRISE.CHRID;
  Result.CHRCODE  :=AELEENTERPRISE.CHRCODE;
  Result.DISPCODE :=AELEENTERPRISE.DISPCODE;
  Result.CHRNAME  :=AELEENTERPRISE.CHRNAME;
  Result.LEVELNUM :=AELEENTERPRISE.LEVELNUM;
  Result.ISLEAF   :=AELEENTERPRISE.ISLEAF;
  Result.ENABLED  :=AELEENTERPRISE.ENABLED;
  Result.CREATEDATE:=AELEENTERPRISE.CREATEDATE;
  Result.CREATEUSER:=AELEENTERPRISE.CREATEUSER;
  Result.LATESTOPDATE:=AELEENTERPRISE.LATESTOPDATE;
  Result.ISDELETED:=AELEENTERPRISE.ISDELETED;
  Result.LATESTOPUSER:=AELEENTERPRISE.LATESTOPUSER;
  Result.LASTVER  :=AELEENTERPRISE.LASTVER;
  Result.CHRCODE1 :=AELEENTERPRISE.CHRCODE1;
  Result.CHRCODE2 :=AELEENTERPRISE.CHRCODE2;
  Result.CHRCODE3 :=AELEENTERPRISE.CHRCODE3;
  Result.CHRCODE4 :=AELEENTERPRISE.CHRCODE4;
  Result.CHRCODE5 :=AELEENTERPRISE.CHRCODE5;
  Result.RGCODE   :=AELEENTERPRISE.RGCODE;
  Result.MAINCODE :=AELEENTERPRISE.MAINCODE;
  Result.UNIONCODE:=AELEENTERPRISE.UNIONCODE;
  Result.ENPROPERTY:=AELEENTERPRISE.ENPROPERTY;
  Result.SORTPROPERTY:=AELEENTERPRISE.SORTPROPERTY;
  Result.ENCHARGE :=AELEENTERPRISE.ENCHARGE;
  Result.FINANCECHARGE:=AELEENTERPRISE.FINANCECHARGE;
  Result.CLERK    :=AELEENTERPRISE.CLERK;
  Result.DISTRICTNUMBER:=AELEENTERPRISE.DISTRICTNUMBER;
  Result.TELEPHONE:=AELEENTERPRISE.TELEPHONE;
  Result.EXTENSIONNUMBER:=AELEENTERPRISE.EXTENSIONNUMBER;
  Result.ADDRESS  :=AELEENTERPRISE.ADDRESS;
  Result.MANAGELEVEL:=AELEENTERPRISE.MANAGELEVEL;
  Result.RELATION :=AELEENTERPRISE.RELATION;
  Result.PARENTID :=AELEENTERPRISE.PARENTID;
  Result.CHRID1   :=AELEENTERPRISE.CHRID1;
  Result.CHRID2   :=AELEENTERPRISE.CHRID2;
  Result.CHRID3   :=AELEENTERPRISE.CHRID3;
  Result.CHRID4   :=AELEENTERPRISE.CHRID4;
  Result.CHRID5   :=AELEENTERPRISE.CHRID5;
  Result.CHRCODE6 :=AELEENTERPRISE.CHRCODE6;
  Result.CHRCODE7 :=AELEENTERPRISE.CHRCODE7;
  Result.CHRCODE8 :=AELEENTERPRISE.CHRCODE8;
  Result.CHRCODE9 :=AELEENTERPRISE.CHRCODE9;
  Result.CHRID6   :=AELEENTERPRISE.CHRID6;
  Result.CHRID7   :=AELEENTERPRISE.CHRID7;
  Result.CHRID8   :=AELEENTERPRISE.CHRID8;
  Result.CHRID9   :=AELEENTERPRISE.CHRID9;
  Result.ISREFORM :=AELEENTERPRISE.ISREFORM;
  Result.STARTDATE:=AELEENTERPRISE.STARTDATE;
  Result.ENDDATE  :=AELEENTERPRISE.ENDDATE;
  Result.SECRETDEGREE:=AELEENTERPRISE.SECRETDEGREE;
  Result.ISBUDGET :=AELEENTERPRISE.ISBUDGET;
  Result.LULOADMOD:=AELEENTERPRISE.LULOADMOD;
  Result.ENCFMOD  :=AELEENTERPRISE.ENCFMOD;
  Result.BSID     :=AELEENTERPRISE.BSID;
  Result.RESERVEAMT:=AELEENTERPRISE.RESERVEAMT;
  Result.RESERVESTART:=AELEENTERPRISE.RESERVESTART;
  Result.RESERVEUSED:=AELEENTERPRISE.RESERVEUSED;
  Result.MBID     :=AELEENTERPRISE.MBID;
  Result.ENTYPE   :=AELEENTERPRISE.ENTYPE;
  Result.DIVKIND  :=AELEENTERPRISE.DIVKIND;
  Result.DIVFMKIND:=AELEENTERPRISE.DIVFMKIND;
  Result.ISLEGALINC:=AELEENTERPRISE.ISLEGALINC;
  Result.ISSYNC   :=AELEENTERPRISE.ISSYNC;
  Result.ISNEW    :=AELEENTERPRISE.ISNEW;
  Result.ISVERTICAL:=AELEENTERPRISE.ISVERTICAL;
  Result.BUSINESSTYPE:=AELEENTERPRISE.BUSINESSTYPE;
  Result.FINANCETYPE:=AELEENTERPRISE.FINANCETYPE;
  Result.MANAGETYPE:=AELEENTERPRISE.MANAGETYPE;
end;

end.

